#pragma once

#include <string>

#include "codegenerator.h"

using std::vector;
using std::string;
using std::map;

using namespace Thinder;

string generateExpression(ParseTree::Name ns, ParseTree::Expression &expr, ParseTree::Type typeHint);
string generateAssignment(ParseTree::Name ns, ParseTree::Assignment &ass);
vector<string> generateOpExpr2(ParseTree::Name ns, ParseTree::OpExpr &oe, ParseTree::Type typeHint);
void parenthesize(vector<string> &tokens, int i, bool non);
bool isOperator(string &op);
void processOperators(vector<string> &tokens);
void processOperators_raw(vector<string> &tokens);
ParseTree::Type getTokenType(string &token);
void expandOperators(vector<string> &tokens);
string generateOpExpr(ParseTree::Name ns, ParseTree::OpExpr &oe, ParseTree::Type typeHint);
string generateUnary(ParseTree::Name ns, ParseTree::Unary &unary, ParseTree::Type typeHint);
vector<ParseTree::IdentRest> primaryPostToIdentRest(ParseTree::PrimaryPost &pp);
ParseTree::Expression generateLiteralExpression(ParseTree::Literal::LiteralType literalType, string literal);
string generatePrimary(ParseTree::Name ns, ParseTree::Primary &primary, ParseTree::Type typeHint);
